package com.bcx.controller;

import com.bcx.pojo.Fsqs;
import com.bcx.service.FsqsService;
import com.bcx.tool.ResultEntity;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.xml.soap.Detail;

@RestController
public class FsqsController {
    @Resource
    FsqsService fsqsService;
    @RequestMapping("/selectFsqs")
    public ResultEntity<PageInfo<Fsqs>> selectAll(@RequestParam(value = "title",required = false,defaultValue = "0")String title
            , @RequestParam(value = "pageNum",required = false,defaultValue = "1")Integer pageNum){
        PageInfo<Fsqs> pageInfo=fsqsService.selectAll(title,pageNum);
        return ResultEntity.successWithoutData(pageInfo);
    }
    @RequestMapping("/saveFsqs")
    public ResultEntity<String> saveFsqs(@RequestBody Fsqs fsqs){
        Integer integer=0;
        integer=fsqsService.insert(fsqs);
        return ResultEntity.successWithoutData(integer+"");
    }
    @RequestMapping("/getEntryById")
    public ResultEntity<Fsqs>getEntryById(Integer id){
        Fsqs fsqs=fsqsService.getById(id);
        return ResultEntity.successWithoutData(fsqs);
    }
}
